﻿using System.Xml.Linq;
using Maple.Weixin.MP.Helpers;

namespace Maple.Weixin.MP.Entities.Messages
{
    public sealed class RequestMessageEventScan : RequestMessageEventBase
    {
        public override Event Event
        {
            get { return Event.scan; }
        }

        public string EventKey { get; private set; }
        public string Ticket { get; private set; }

        protected override void FillPropertiesByXml(XDocument document)
        {
            base.FillPropertiesByXml(document);
            this.EventKey = document.GetElementValue("EventKey", true);
            this.Ticket = document.GetElementValue("Ticket", true);
        }

        public override T Accept<T>(RequestMessageVisitor<T> visitor) {
            return visitor == null ? default(T) : visitor.Visit(this);
        }
    }
}
